<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script type="text/javascript">
	function dirayTypeDelete(dirayTypeId){
		if(confirm("你确定要删除这个日记类别？")){
			var dirayTypeListForm = document.getElementById("dirayTypeListForm") ;
			dirayTypeListForm.action = "${pageContext.request.contextPath}/dirayType?method=delete&dirayTypeId=" + dirayTypeId ;
			dirayTypeListForm.submit() ;
		}
	}
	function dirayTypeAdd(){
		var dirayTypeListForm = document.getElementById("dirayTypeListForm") ;
		dirayTypeListForm.action = "${pageContext.request.contextPath}/dirayType?method=addUI" ;
		dirayTypeListForm.submit() ;
	}
	function dirayTypeEdit(dirayTypeId){
		var dirayTypeListForm = document.getElementById("dirayTypeListForm") ;
		dirayTypeListForm.action = "${pageContext.request.contextPath}/dirayType?method=editUI&dirayTypeId=" + dirayTypeId ;
		dirayTypeListForm.submit() ;
	}
</script>

<div class="data_list">
	<form action="" method="post" name="dirayTypeListForm" id="dirayTypeListForm">
		<div class="data_list_title">
			<img src="${pageContext.request.contextPath}/images/list_icon.png" />
			日记类别列表 <span class="diaryType_add">
				<button class="btn btn-mini btn-success" onclick="dirayTypeAdd()" type="button">添加日志类别</button>
			</span>
		</div>
		<div>
			<table class="table table-hover table-striped">
				<tr>
					<th>编号</th>
					<th>类别名称</th>
					<th>操作</th>
				</tr>
					
					<c:forEach var="diaryType" items="${dirayTypeList }">
						<tr>
							<td>${diaryType.dirayTypeId }</td>
							<td>${diaryType.dirayTypeName }</td>
							<td><button class="btn btn-mini btn-info" type="button" onclick="dirayTypeEdit('${diaryType.dirayTypeId}')">修改</button>&nbsp;
								<button class="btn btn-mini btn-danger" type="button" onclick="dirayTypeDelete('${diaryType.dirayTypeId}')">删除</button></td>
						</tr>
					</c:forEach>
				
			</table>
		</div>
	</form>
</div>
